// components/image/image.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        item:Object
    },

    /**
     * 组件的初始数据
     */
    data: {
        time:0
    },
    attached(){
        let propTime = this.properties.item.duration
        if(propTime>3600){
            let time  = this.setTimeLong(propTime)
            this.setData({
                time:time
              })
        }
        else if(propTime<3600){
            let time  = this.setTimeShort(propTime)
            this.setData({
                time:time
              })
        }
        
    },
    /**
     * 组件的方法列表
     */
    methods: {
        setTimeLong(value){
            let m = parseInt(value/1000/60);
            let s = parseInt(value/1000%60);
            m=m<10?"0"+m:m
            s=s<10?"0"+s:s
            return m+":"+s
        },
        setTimeShort(t){
            let m = parseInt(t/60)
            let s = parseInt(t%60)
            m=m<10?"0"+m:m
            s=s<10?"0"+s:s
            return m+"'"+s+"'"
        }

    }
})
